import requests

class nameadd:
    def __init__(self):
        self.host = "http://192.168.4.108"
        self.session=requests.session()
        login_url=self.host+'/TinyShop//index.php?con=admin&act=check'
        login_data={'name':'admin','password':'123456'}
        loginres=self.session.post(login_url,login_data)
        # print(loginres.text)
        # try:
        #     if "退出" in loginres.text:
        #         print("登录成功")
        #     else:
        #         print("登录失败，用户名或密码错误")
        # except:
        #     print("验证码错误")
    def add(self,x):
        add_url=self.host+'/TinyShop//index.php?con=goods&act=goods_save'
        addres=self.session.post(add_url,x)
        return addres.text
